let readlineSync = require('readline-sync');
 
function main(num1,num2) {
    let number1 = [];
    let number2 = [];
    for(let i = 0;i <= 3;i++){
        number1.push(num1.toString().charAt(i));
        number2.push(num2.toString().charAt(i));
    }
    let A_number=0;
    for(let i in number1){
        if(number1[i] === number2[i]){
            A_number++;
        }
    }
    let B_number=0;
    for(let item1 of number1){
        for(let item2 of number2){
            if(item1 === item2){
                B_number++;
            }
        }
    }
    B_number-=A_number;
    let result=`${A_number}A${B_number}B`;
    return result;
}


module.exports = main;
main(1234,1234);